
package com.meida.module.bus.provider.controller;

import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.security.OpenHelper;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.bus.client.entity.AppUserExtra;
import com.meida.module.bus.provider.service.AppUserExtraService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;


@RestController
@RequestMapping("/appUserMeCenter/")
@Api(tags = "用户个人中心")
public class AppUserMeController extends BaseController<AppUserExtraService, AppUserExtra> {

    @Resource
    AppUserExtraService appUserExtraService;


    @ApiOperation(value = "查询个人信息", notes = "查询个人信息")
    @GetMapping(value = "getMeInfo")
    public ResultBody getMeInfo(@RequestParam(required = false) Map params) {
        if (null == OpenHelper.getUserId()) {
            return ResultBody.failed("未绑定个人信息");
        }
        //AppUserExtra appUserExtra = appUserExtraService.getById(OpenHelper.getUserId());
        //EntityMap vipInfo  =(EntityMap) appUserExtraService.getAppUserVipInfo(OpenHelper.getUserId());
        return ResultBody.ok(appUserExtraService.getMeInfo(params));
    }

    @ApiOperation(value = "分享海报图片", notes = "分享海报图片")
    @GetMapping(value = "sharePoster")
    public ResultBody sharePoster() {
        return ResultBody.ok(appUserExtraService.sharePoster());
    }
}
